package spi;

import java.util.Iterator;
import java.util.ServiceLoader;

/**
 * @author zhangxin
 * @date 2021/5/20
 */
public class SPIDemo {


    static int i;
    static {
        i = 0;
        System.out.println(i);
    }

    public static void main(String[] args) {

        ServiceLoader<MyInterface> load = ServiceLoader.load(MyInterface.class);

        Iterator<MyInterface> iterator = load.iterator();

        while (iterator.hasNext()) {
            MyInterface myInterface =iterator.next();
            myInterface.say();
        }
    }
}
